#include <iostream>

int fact(int val) {
    if (val < 0) {
        return -1;
    }
    int ret = 1;
    for (int i = 1; i != val + 1; ++i) {
        ret *= i;
    }
    return ret;
}

int main(void) {
    using namespace std;
    cout << "Enter a integer for factorial:\n";
    int val;
    cin >> val;
    cout << "factorial is : " << fact(val) << endl;

    return 0;
}
